#ifndef _GENERATOR_H_
#define _GENERATOR_H_

#include "EventProcessor.h"
#include "EventProcessorImp.h"
#include "Message.h"
#include "DistributedCounter.h"

#define REPETITIONS 100

class GeneratorImp : public EventProcessorImp {

private:

  long int counter;  

  DistributedCounter& dCounter;

  EventProcessor Master; 

  // function to help in generating messages
  void GenerateAndSendNumber(void);

  GeneratorImp(EventProcessor& _master, DistributedCounter& _dCounter);

  MESSAGE_HANDLER_DECLARATION(NumberAdded);	

  friend class Generator;
};

// Interface class
class Generator : public EventProcessor {
public:
  Generator(EventProcessor& _master, DistributedCounter& _dCounter);
};

inline Generator::Generator(EventProcessor& _master, DistributedCounter& _dCounter){
  evProc = new GeneratorImp(_master, _dCounter);
}

#endif // _GENERATOR_H_
